package cn.darkhorse.alarm.service.alarm;

import cn.darkhorse.alarm.pojo.AlarmParameterSettings;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Map;

/**
 * 开关量，为true时预警
 * @author yuanjun
 * @since 2023/4/7 13:46
 */
@Component
public class SwitchAlarm extends BaseAlarm implements Alarm{
    @Resource
    private StringRedisTemplate stringRedisTemplate;

    @Override
    public void doAlarm(AlarmParameterSettings settings, Map<String,Object> data) {
        String value = (String) data.get(settings.getFieldName());
        if(StringUtils.isBlank(value) || !settings.getParameterType().equals(ALARM_PARAMETER_TYPE_SWITCH)) {
            return;
        }
        //判断告警
        noNumerical(settings,data);
        
    }
}
